package org.mch.comm.converter.hib;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

import org.mch.comm.lang.MTime;

/**
 * 
 */
@Converter(autoApply = true)
public class MTimeConverter implements AttributeConverter<MTime, String> {

	@Override
	public String convertToDatabaseColumn(MTime attribute) {
		if (attribute == null) {
			return null;
		}
		return attribute.getValue();
	}

	@Override
	public MTime convertToEntityAttribute(String dbData) {
		if (dbData == null) {
			return null;
		}
		return new MTime(dbData);
	}

}
